package org.example.yuaiagent;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.sql.SQLException;


@SpringBootApplication
public class YuAiAgentApplication {

    public static void main(String[] args) throws SQLException {
//        SpringApplication.run(YuAiAgentApplication.class, args);
        ConfigurableApplicationContext context = SpringApplication.run(YuAiAgentApplication.class, args);

//        String[] beanNames = context.getBeanDefinitionNames();
//        for (String name : beanNames) {
//            Object bean = context.getBean(name);
//            if (bean instanceof javax.sql.DataSource) {
//                System.out.println("Bean Name: " + name + " -> " + bean.getClass().getName());
//            }
//            if(bean instanceof org.springframework.jdbc.core.JdbcTemplate){
//                System.out.println("JdbcTemplate Bean Name: " + name + " -> " + bean.getClass().getName());
//                JdbcTemplate jdbcTemplate = (JdbcTemplate) bean;
//                System.out.println("JdbcTemplate dataSource URL: " +
//                        jdbcTemplate.getDataSource().getConnection().getMetaData().getURL());
//
//            }
//            ;
//        };
    }

}
